import {
  FormItemProps,
  FormProps,
  InputNumberProps,
  InputProps,
  ISelectProps
} from "element-plus";

type TType = "Input" | "Select" | "InputNumber";

interface IFormItemProps extends Partial<FormItemProps> {
  type: TType;
  prop: string;
}
// Input 组件
type IInputProps = Partial<InputProps> &
  IFormItemProps & {
    style?: {
      [key: string]: any;
    };
    inputType?: "text" | "password" | "textarea";
  };
// Select 组件
type IISelectProps = Partial<ISelectProps> &
  IFormItemProps & {
    options?: Array<{ label: string; value: string | number }>;
    style?: {
      [key: string]: any;
    };
  };

// Input Number 组件
type IInputNumberProps = Partial<InputNumberProps> & IFormItemProps & {};

// FormItem 组件
type TFormItemsProps = Array<IInputProps | IISelectProps | IInputNumberProps>;

interface IFormProps<T = any> extends Partial<FormProps> {
  formItems: TFormItemsProps;
  formData: T;
}

export type { IFormProps, IInputProps, IISelectProps };
